{% extends "LololTeamBundle::layout.html.twig" %}

{% block javascripts %} 
{{ parent() }}

<script type="text/javascript">
	$(document).ready(function() {
		$('.delete').on('click', function() {
			var msg = '{{ 'team.delete.confirm'|trans|e('js') }}';
			msg = msg.replace("%teamName%", $(this).attr('id'));
			return confirm(msg);
		});
	});
</script>
{% endblock %}

{% block lolol_help_body %}
{{ 'team.list.help'|trans }}
{% endblock %}

{% block lolol_title %}{{ 'team.myTeams'|trans }}{% endblock %}

{% block lolol_main %}
{% for result in results %}
	{% if loop.first %}
		<div class="row">
			<div class="col-xs-12 col-sm-10 col-md-8">
				<div class="row">
					<div class="col-xs-3">
						<strong>{{ 'team.names'|trans }}</strong>
					</div>
					<div class="col-xs-9">
						<strong>{{ 'team.selectedChampions'|trans }}</strong>
					</div>
				</div>
			</div>
		</div>
		<br />
	{% endif %}
	<div class="row">
		<div class="col-xs-12 col-sm-10 col-md-8">
			<div class="row">
				<div class="col-xs-3">
					<div class="col-xs-12">
						<i class="fa fa-caret-right"></i> {{ result.team.name }}
					</div>
					<div class="col-xs-12">
						<a href="{{ path('lolol_team_teamBuilder', {'id': result.team.id } ) }}" alt="{{ 'team.consult'|trans }}" title="{{ 'team.consult'|trans }}"><i class="fa fa-search"></i></a>
						<a href="{{ path('lolol_team_teamBuilder', {'id': result.team.id } ) }}" alt="{{ 'team.edit'|trans }}" title="{{ 'team.edit'|trans }}"><i class="fa fa-pencil"></i></a>
						<a id="{{ result.team.name }}" href="{{ path('lolol_team_teamDelete', {'id': result.team.id } ) }}" class="delete" alt="{{ 'team.delete'|trans }}" title="{{ 'team.delete'|trans }}"><i class="fa fa-trash-o"></i></a>
					</div>
				</div>
				<div class="col-xs-9 gutter-1 compacted-gallery">
					{% for championTeam in result.champions %}
					<div class="col-xs-2">
						<div class="thumbnail text-center overflow-hidden">
							<img 
								src="{{ asset(folder ~ '/img/' ~ prefixIcons48 ~ championTeam.champion.imgName ~suffixIcons) }}"
								alt="{{ championTeam.champion.name }}" /> 
								<a href="{{ path('lolol_app_champion', { 'id': championTeam.champion.id }) }}" title="{{ championTeam.champion.name }}"><small>{{
									championTeam.champion.name }}</small></a>
						</div>								
					</div>
					{% else %}
					BUG: empty team
					{% endfor %}
				</div>
			</div>
		</div>
	</div>
{% else %}
	<p>{{ 'team.myTeams.empty'|trans }}</p>
{% endfor %}
{% endblock %}
